﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using FONCREAGROINTEGRAL.Models;
namespace FONCREAGROINTEGRAL.Controllers
{
    public class deduccionController : Controller
    {
        public SistIntFoncreagroEntities entidades = new SistIntFoncreagroEntities();
        //
        // GET: /deduccion/

        public ActionResult Index()
        {

            return View();
        }

        public ActionResult IndexAll()
        {
           // var query = entidades.DEDUCCIONs.ToList();

            int start = Convert.ToInt32(Request.QueryString["start"]);
            int limit = Convert.ToInt32(Request.QueryString["limit"]);

       //     string NomBanco = Convert.ToString(Request.QueryString["query"]);

            var query2 = entidades.DEDUCCIONs
                .Where(n => n.iddeduccion >= 1);


            var result = (from b in query2.OrderBy(ne => ne.uit).Skip(start).Take(limit).ToList()
                          select new
                          {
                              iddeduccion = b.iddeduccion,
                              uit = b.uit
                          }).ToList();

            return Json(new { grid = result, total = query2.Count() }, JsonRequestBehavior.AllowGet);
         //   return Json(new { grid = query2, total = query2.Count() }, JsonRequestBehavior.AllowGet);
        }

    }
}
